/*    */ package com.infoservice.schedule.test;
/*    */ 
/*    */ import java.io.PrintStream;
/*    */ import java.util.LinkedList;
/*    */ import org.apache.log4j.Logger;
/*    */ 
/*    */ public class TaskLoadThread extends Thread
/*    */ {
/* 26 */   private static Logger logger = Logger.getLogger(TaskLoadThread.class.getSimpleName());
/* 27 */   private LinkedList<Integer> queue = new LinkedList();
/* 28 */   private boolean flag = false;
/* 29 */   private static TaskLoadThread taskLoad = null;
/*    */ 
/*    */   public TaskLoadThread(String name)
/*    */   {
/* 34 */     super(name);
/*    */   }
/*    */ 
/*    */   public void run() {
/* 38 */     while (!this.flag) {
/* 39 */       logger.debug("Enter TaskLoadThread run");
/* 40 */       this.queue.add(Integer.valueOf(1));
/* 41 */       this.queue.add(Integer.valueOf(2));
/* 42 */       logger.debug("Add Success" + this.queue.toString() + ",queue.size()===" + this.queue.size());
/* 43 */       synchronized (this.queue) {
/* 44 */         this.queue.notifyAll();
/* 45 */         logger.info("come here");
/*    */         try {
/* 47 */           synchronized (this) {
/* 48 */             sleep(10000L);
/*    */           }
/*    */         }
/*    */         catch (InterruptedException e) {
/* 52 */           e.printStackTrace();
/*    */         }
/*    */       }
/*    */     }
/*    */   }
/*    */ 
/*    */   public Integer getQueueItem()
/*    */   {
/* 60 */     synchronized (this.queue) {
/* 61 */       if (this.queue.size() == 0) {
/* 62 */         logger.debug("queue.size()=======0");
/* 63 */         return null;
/*    */       }
/* 65 */       return (Integer)this.queue.removeFirst();
/*    */     }
/*    */   }
/*    */ 
/*    */   public static synchronized TaskLoadThread getInstance() {
/* 69 */     if (taskLoad == null) {
/* 70 */       logger.debug("taskLod===============null");
/* 71 */       taskLoad = new TaskLoadThread(TaskLoadThread.class.getCanonicalName());
/*    */     }
/* 73 */     return taskLoad;
/*    */   }
/*    */   public static void main(String[] args) {
/* 76 */     getInstance().start();
/* 77 */     ExecuteThread et = new ExecuteThread("ExeThread1");
/* 78 */     ExecuteThread et2 = new ExecuteThread("ExeThread2");
/* 79 */     ExecuteThread et3 = new ExecuteThread("ExeThread3");
/* 80 */     ExecuteThread et4 = new ExecuteThread("ExeThread4");
/* 81 */     et.start();
/* 82 */     System.out.println("sssssssssssss===============" + getInstance().getQueueItem());
/* 83 */     et2.start();
/* 84 */     et3.start();
/* 85 */     et4.start();
/*    */   }
/*    */ }

/* Location:           D:\Workspace\Work\ASMP_DE\lib\frame3\InfoSchedule_1.0.03.jar
 * Qualified Name:     com.infoservice.schedule.test.TaskLoadThread
 * JD-Core Version:    0.6.0
 */